package net.bwie.dt.funtion;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.bwie.dt.bean.LogBean;
import org.apache.flink.api.common.functions.MapFunction;


public class dtBeanMapFuctionLog implements MapFunction<String, LogBean> {

    @Override
    public LogBean map(String s) throws Exception {
        JSONObject jsonObject = JSON.parseObject(s);
        Integer log_id = jsonObject.getInteger("log_id");
        Integer user_id = jsonObject.getInteger("user_id");
        Integer produce_id = jsonObject.getInteger("produce_id");
        Integer number = jsonObject.getInteger("number");
        String action_type = jsonObject.getString("action_type");
        String page_type = jsonObject.getString("page_type");
        String event_type = jsonObject.getString("event_type");
        String ts = jsonObject.getString("ts");
        return new LogBean(
                log_id
                ,user_id
                ,produce_id
                ,number
                ,action_type
                ,page_type
                ,event_type
                ,ts
        );
    }
}
